﻿<!--
    © 2012 Alex Kazaev
    FolderDrive project [http://folderdrive.codeplex.com/]
    Licensed under Ms-PL license [http://www.opensource.org/licenses/MS-PL]
-->
<Window x:Class="FolderDrive.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:FolderDrive.Controls"
        Title="FolderDrive"
        Width="525"
        Height="350"
        MinWidth="525"
        MinHeight="350"
        Closing="OnWindowClosing"
        Icon="/FolderDrive;component/Resources/harddrive.ico"
        StateChanged="OnWindowStateChanged">
    <Window.Resources>
        <ImageBrush x:Key="toolBrush"
                    AlignmentX="Left"
                    AlignmentY="Top"
                    ImageSource="Resources/toolbarback.png"
                    Stretch="None"
                    TileMode="Tile"
                    Viewport="0,0,80,40"
                    ViewportUnits="Absolute" />
        <ImageBrush x:Key="backBrush"
                    AlignmentX="Left"
                    AlignmentY="Top"
                    ImageSource="Resources/toolbarback.png"
                    Opacity="0.3"
                    Stretch="None"
                    TileMode="Tile"
                    Viewport="0,0,80,40"
                    ViewportUnits="Absolute" />
    </Window.Resources>
    <Grid Background="{StaticResource ResourceKey=backBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0"
                    Background="{StaticResource ResourceKey=toolBrush}"
                    IsEnabled="{Binding IsToolbarEnabled}"
                    Orientation="Horizontal">
            <Button Width="100"
                    Margin="1 1 10 1"
                    Click="OnAddMappingClick">
                <StackPanel Orientation="Vertical">
                    <Image Width="24"
                           Height="24"
                           Source="Resources/Add.png" />
                    <TextBlock>Add Mapping</TextBlock>
                </StackPanel>
            </Button>
            <Button Width="100"
                    Margin="1 1 10 1"
                    Click="OnRemoveSelectedClick">
                <StackPanel Orientation="Vertical">
                    <Image Width="24"
                           Height="24"
                           Source="Resources/Delete.png" />
                    <TextBlock>Remove Selected</TextBlock>
                </StackPanel>
            </Button>
            <Button Width="100"
                    Margin="1 1 10 1"
                    Click="OnOptionsButtonClick">
                <StackPanel Orientation="Vertical">
                    <Image Width="24"
                           Height="24"
                           Source="Resources/Options.png" />
                    <TextBlock>Options</TextBlock>
                </StackPanel>
            </Button>
            <Button Width="100"
                    Margin="1 1 5 1"
                    Click="OnInfoButtonClick">
                <StackPanel Orientation="Vertical">
                    <Image Width="24"
                           Height="24"
                           Source="Resources/Info.png" />
                    <TextBlock>About</TextBlock>
                </StackPanel>
            </Button>
            <Image Height="50"
                   MouseDown="OnUpdateMouseDown"
                   Source="Resources/NewVersion.png"
                   ToolTip="New version is available! Click here to go to download page."
                   Visibility="{Binding UpdateVisibility}" />
        </StackPanel>
        <Canvas Name="MainCanvas"
                Grid.Row="1"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch">
            <Controls:MappingGridControl Width="{Binding ActualWidth,
                                                         ElementName=MainCanvas}"
                                         Height="{Binding ActualHeight,
                                                          ElementName=MainCanvas}"
                                         HorizontalAlignment="Stretch"
                                         VerticalAlignment="Stretch"
                                         Visibility="{Binding MappingGridVisibility}" />
            <Controls:AddMappingControl x:Name="addMappingControl"
                                        Width="{Binding ActualWidth,
                                                        ElementName=MainCanvas}"
                                        Height="{Binding ActualHeight,
                                                         ElementName=MainCanvas}"
                                        Visibility="{Binding AddMappingVisibility}" />
            <Controls:InfoControl x:Name="infoControl"
                                  Width="{Binding ActualWidth,
                                                  ElementName=MainCanvas}"
                                  Height="{Binding ActualHeight,
                                                   ElementName=MainCanvas}"
                                  Visibility="{Binding InfoVisibility}" />
            <Controls:OptionsControl x:Name="optionsControl"
                                     Width="{Binding ActualWidth,
                                                     ElementName=MainCanvas}"
                                     Height="{Binding ActualHeight,
                                                      ElementName=MainCanvas}"
                                     Visibility="{Binding OptionsVisibility}" />
        </Canvas>
    </Grid>
</Window>